Skip to content

feat(go/plugins/googlegenai): Support tuned Gemini endpoint models#5178

Open
cabljac wants to merge 3 commits into
mainfrom
feat/go-googlegenai-tuned-gemini
Open

feat(go/plugins/googlegenai): Support tuned Gemini endpoint models#5178
cabljac wants to merge 3 commits into
mainfrom
feat/go-googlegenai-tuned-gemini

Conversation

@cabljac
Copy link
Copy Markdown
Contributor

@cabljac cabljac commented Apr 23, 2026

Accepts Vertex AI tuned Gemini endpoints addressed either by the short form endpoints/ID or the full resource path projects/PROJECT/locations/LOCATION/endpoints/ID.

ClassifyModel now routes these names to ModelTypeGemini, and a new resolveVertexModelName helper expands the short form to the full path before the google.golang.org/genai SDK transforms it — avoiding the SDK's default publishers/google/models/ prefix, which only applies to first-party models. VertexAI.DefineModel also accepts tuned endpoint names with a nil options argument and falls back to the default Gemini capability set.

Mirrors js/plugins/google-genai/src/vertexai/client.ts.

Testing

image

Accept Vertex AI tuned endpoints addressed either by the short form
`endpoints/ID` or the full resource path
`projects/PROJECT/locations/LOCATION/endpoints/ID`. ClassifyModel now
routes these names to ModelTypeGemini, and a new resolveVertexModelName
helper expands the short form to the full path before the
google.golang.org/genai SDK transforms it, avoiding the SDK's default
`publishers/google/models/` prefix that only applies to first-party
models.

VertexAI.DefineModel also accepts tuned endpoint names with a nil
options argument, falling back to the default Gemini capability set.

Adds unit tests for ClassifyModel and isTunedGeminiName, and a live
subtest in vertexai_live_test.go gated by GENKIT_VERTEX_TUNED_ENDPOINT.
Mirrors the JS behaviour in js/plugins/google-genai/src/vertexai/client.ts.
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for Vertex AI tuned Gemini endpoints, allowing them to be addressed via short-form or full resource paths. Key changes include the addition of a name resolution helper, updates to model classification logic, and modifications to the model definition process to accommodate these dynamic endpoints. A critical feedback point identifies that tuned endpoints, which are not in the static model list, would receive empty model options; a suggestion was provided to use default Gemini options instead to ensure proper capability support.

Comment thread go/plugins/googlegenai/googlegenai.go
cabljac added a commit that referenced this pull request Apr 23, 2026
Accepts Vertex AI tuned endpoints addressed either by the short form
`endpoints/ID` or the full resource path
`projects/PROJECT/locations/LOCATION/endpoints/ID`.

- gemini.py gains is_tuned_gemini_name() and resolve_vertex_model_name()
  helpers; both generate_content call sites wrap the model name through
  the latter so the SDK receives a fully qualified path and skips its
  default publishers/google/models/ prefixing.
- VertexAI._resolve_model routes tuned endpoint names through GeminiModel
  with the standard Gemini config schema and a sensible label.
- Skip list_actions injection — tuned endpoints are private and not
  publicly listable.
- Mirrors the Go PR #5178 design and the JS behaviour in
  js/plugins/google-genai/src/vertexai/client.ts.
- Adds a unit test file covering both helpers and all dispatch paths.
Copy link
Copy Markdown

@adesinah adesinah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good changes, I left a few comments.

Comment thread go/plugins/googlegenai/gemini.go
Comment thread go/plugins/googlegenai/model_type.go Outdated
Comment thread go/plugins/googlegenai/gemini.go
Comment thread go/plugins/googlegenai/googlegenai.go
cabljac added 2 commits May 20, 2026 16:17
Exercises the four branches: short form on Vertex (expanded), already
fully-qualified path (unchanged), non-tuned name (unchanged), and
short form on the Gemini API backend (unchanged). Uses real
*genai.Client instances with HTTPClient set to skip ADC lookup so
the test stays hermetic.
Tighten isTunedGeminiName so the projects/.../endpoints/... branch only
matches the real Vertex resource shape, which always contains
/locations/.
@cabljac cabljac marked this pull request as ready for review May 22, 2026 06:50
@cabljac cabljac requested a review from apascal07 May 22, 2026 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants